{{ if .Section }}
<nav class="post-nav">
  <span class="nav-prev">{{ with .PrevInSection }}<a href="{{ .RelPermalink }}">{{ .Title }}</a><br/>&larr;{{ end }}</span>
  <span class="nav-next">{{ with .NextInSection }}<a href="{{ .RelPermalink }}">{{ .Title }}</a><br/>&rarr;{{ end }}</span>
</nav>
<script type="text/javascript">
document.addEventListener('keyup', function(e) {
  if (e.target.nodeName.toUpperCase() != 'BODY') return;
  var url = false;
  if (e.which == 37) {  // Left arrow
    {{ if .PrevInSection }}
    url = '{{ .PrevInSection.RelPermalink }}';
    {{ end }}
  } else if (e.which == 39) {  // Right arrow
    {{ if .NextInSection }}
    url = '{{ .NextInSection.RelPermalink }}';
    {{ end }}
  }
  if (url) window.location = url;
});
</script>
{{ end }}

{{ partial "utterances.html" . }}

{{ range .Site.Params.customJS }}
<script async src="{{ . | relURL }}"></script>
{{ end }}

{{if .Page.Site.Params.fancybox }}
<script src="https://cdn.jsdelivr.net/npm/jquery@3.5.1/dist/jquery.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.css" />
<script src="https://cdn.jsdelivr.net/gh/fancyapps/fancybox@3.5.7/dist/jquery.fancybox.min.js"></script>
{{ end }}
<script async src="{{ $.Site.BaseURL }}/js/fix-toc.js"></script>
<script async src="{{ $.Site.BaseURL }}/js/center-img.js"></script>
<script async src="{{ $.Site.BaseURL }}/js/right-quote.js"></script>
<script async src="{{ $.Site.BaseURL }}/js/fix-footnote.js"></script>
<script async src="{{ $.Site.BaseURL }}/js/math-code.js"></script>
<script async src="{{ $.Site.BaseURL }}/js/external-link.js"></script>
<script async src="{{ $.Site.BaseURL }}/js/alt-title.js"></script>
<script async src="{{ $.Site.BaseURL }}/js/header-link.js"></script>
<script async src="{{ $.Site.BaseURL }}/js/dom-scripts.js"></script>
<script type="text/javascript" async src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML"></script>
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@11.3.1/build/highlight.min.js"></script>
<script>hljs.highlightAll();</script>
